package org.stars.message;

/**
 * @author 沧月
 * @date 2020/10/27
 * @desc 描述
 */
public class Message<T> {

    public int code = Code.Code_0.getValue();

    public String msg;

    public T data;

    public Message() {
        this.msg = "Success";
    }

    public Message(String msg) {
        this.msg = msg;
    }

    public Message(String msg, T t) {
        this.msg = msg;
        this.data = t;
    }

    public Message(String msg, T t, Object meta) {
        this.msg = msg;
        this.data = t;
    }

    public int getCode() {
        return code;
    }

    public Message setCode(int code) {
        this.code = code;
        return this;
    }

    public Message setCode(Code code) {
        return this.setCode(code.getValue());
    }

    public String getMsg() {
        return msg;
    }

    public Message setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public T getData() {
        return data;
    }

    public Message setData(T t) {
        this.data = t;
        return this;
    }
}
